package com.panopset.app.panopset;

import static com.panopset.Util.*;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;

/**
 *
 * @author Karl Dinwiddie
 */
public class AboutCanvas extends Canvas {
    private final String title;

    public AboutCanvas(String title) {
        this.title = title;
    }

    @Override
    public void paint(Graphics g) {
        g.setColor(Color.WHITE);
        g.fillRect(getX(), getY(), getWidth(), getHeight());
        g.setColor(Color.BLACK);
        g.drawRect(getX(), getY(), getWidth()-1, getHeight()-1);
        FontMetrics fm = g.getFontMetrics();
        int x = (int) ((getWidth() - fm.stringWidth(title)) / 2);
        g.drawString(title, x,20);
        int b = 255;
        g.setColor(new Color(0x00,0x00,0x33));
        g.fillOval(120, 60, 60, 60);
        for (int j = 60; j > 0; j--) {
            if (b > 0) {
                g.setColor(new Color(b < 200 ? b+30 : b,b,b));
                g.drawOval(120, 60, j, j);
            }
            b = b - 8;
        }
        g.setColor(Color.LIGHT_GRAY);
        g.setFont(ARIAL_PLAIN_9);
        fm = g.getFontMetrics();
        final String copy = COPYRIGHT + " 1996 - 2009 Panopset";
        x = (int) ((getWidth() - fm.stringWidth(copy)) / 2);
        g.drawString(copy, x, 140);
    }


    private static final long serialVersionUID = VERSION_SERIAL_NUMBER;
}
